<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>登录 - SimpleHire</title>
    <link
      th:href="@{/webjars/bootstrap/5.3.0/css/bootstrap.min.css}"
      rel="stylesheet"
    />
  </head>
  <body class="bg-light">
    <div class="container mt-5">
      <div class="row justify-content-center">
        <div class="col-md-6">
          <div class="card shadow">
            <div class="card-body p-5">
              <h2 class="card-title text-center mb-4">登录 SimpleHire</h2>

              <div
                th:if="${param.error}"
                class="alert alert-danger"
                role="alert"
              >
                用户名或密码错误
              </div>
              <div
                th:if="${param.logout}"
                class="alert alert-info"
                role="alert"
              >
                您已成功退出
              </div>
              <div
                th:if="${param.success}"
                class="alert alert-success"
                role="alert"
              >
                注册成功，请登录
              </div>

              <form th:action="@{/login}" method="post">
                <div class="mb-3">
                  <label for="username" class="form-label">用户名</label>
                  <input
                    type="text"
                    class="form-control"
                    id="username"
                    name="username"
                    required
                  />
                </div>
                <div class="mb-3">
                  <label for="password" class="form-label">密码</label>
                  <input
                    type="password"
                    class="form-control"
                    id="password"
                    name="password"
                    required
                  />
                </div>
                <button type="submit" class="btn btn-primary w-100">
                  登录
                </button>
              </form>

              <hr />
              <div class="text-center">
                <p>还没有账号？ <a th:href="@{/register}">立即注册</a></p>
                <p><a th:href="@{/}">返回首页</a></p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <script
      th:src="@{/webjars/bootstrap/5.3.0/js/bootstrap.bundle.min.js}"
    ></script>
  </body>
</html>
